/***************************************************************************
 *   Copyleft 2008-2009 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>			                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __ERRORDIALOG_H__
#define __ERRORDIALOG_H__


#include "./vAbstractModalDialog.h"
#include "../../Utils/vString.h"
#include "../../Macros/vMemoryMacros.h"
#include <commctrl.h>

namespace Vendetta {
	/*! \class vErrorDialog.
	*   \brief A vErrorDialog for application fatal error messages.
	*
	*
	*	\sa AbstractModalDialog.
	*/
	class vErrorDialog: public vAbstractModalDialog {
	public:
		/*! \brief Default constructor.
		*
		*/
		vErrorDialog() { }

		/*! \brief Parameter constructor.
		*
		*	\param	HINSTANCE	hInstance	Handle to appliaction instance with use current dialog.
		*	\param	HWND		hOwnerWnd	Window parent of the dialog.
		*	\param	vString		errorMsg	Error message to be displayed.
		*/
		vErrorDialog(HINSTANCE hInstance, HWND hWndOwner, const vString& errorMsg);

		/*! \brief Parameter constructor.
		*
		*	\param	vString		errorMsg	Error message to be displayed.
		*/
		vErrorDialog(const vString& errorMsg);

		/*! \brief Destructor.
		*
		*/
		~vErrorDialog() { }

		/*! \brief Exec dialog, shows and returs execution code.
		*
		*	\return	vInt	Exec value from DialogBox WinAPI funciton.
		*/
		vInt Exec();

	private:
		static LRESULT CALLBACK dialogProc(HWND hwnd, UINT, WPARAM, LPARAM);

		static vVoid toggleDetails(HWND hwnd, vBool bVisible);

	private:
		static vString mError;
		static HINSTANCE mhInstance;
	};
}

#endif // __ERRORDIALOG_H__